<template>
  <div class="coffee_machineIndex">
    <c-title :hide="false" text="设备详情"></c-title>
    <div class="headBox">
      <div class="left">
        <div class="title mb">
          <span>设备名称：</span>
          <span>{{ name }}</span>
        </div>
        <div class="title sm">设备号：{{ info.device_no }}</div>
      </div>
      <div class="right" @click="show = true">
        <i class="iconfont icon-fontclass-erweima"></i>
      </div>
    </div>
    <div class="ContenBox ftop">
      <div class="entrance" @click="toUrl('cargoWayManage', { device_id: info.id })">
        <div class="entrance_top">
          <img src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/image%2Fcargo1%402x.png" alt="" />
        </div>
        <div class="entrance_txt">货道管理</div>
      </div>
      <div class="entrance pos" @click="toUrl('baseRewardTemplate', {}, { device_id: info.id })">
        <div class="entrance_top">
          <img src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/image%2Fcargo%402x.png" alt="" />
        </div>
        <div class="entrance_txt">我的提成</div>
      </div>
    </div>
    <van-popup v-model="show" closeable round>
      <div class="image">
        <img :src="info.qr_code" alt="" />
      </div>
    </van-popup>
  </div>
</template>
<script>
export default {
  data() {
    return {
      show: false,
      name: "",

      info: []
    };
  },
  activated() {
    console.log(this.$route.name);
    this.getData();
  },
  methods: {
    getData() {
      let json = {
        device_id: this.$route.params.machine_id
      };
      let urlstr = "plugin.gradevin.frontend.owner.device.detail";
      $http.post(urlstr, json, "loading").then(response => {
        if (response.result == 1) {
          this.name = response.data.name || "咖啡机";
          this.info = response.data;
        } else {
          this.$toast(response.msg);
        }
      });
    },
    toUrl(name, params, query) {
      if (name == "baseRewardTemplate") {
        // 跳转模版带参
        let obj = JSON.stringify(query);
        this.$router.push(this.fun.getUrl(name, params, { api: "plugin.gradevin.frontend.owner.dividends.template", extparams: obj }));
        return;
      }
      this.$router.push(this.fun.getUrl(name, params, query));
    }
  }
};
</script>
<style lang="scss" scoped>
.headBox {
  background: linear-gradient(180deg, #28b2fa 0%, #ffffff 100%);
  padding: 1rem 0.75rem;
  padding-bottom: 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .left {
    flex: 1;
    .title {
      text-align: left;
      font-size: 1rem;
      color: #ffffff;
      line-height: 1.41rem;
      .icon-fontclass-qianshu {
        margin-left: 0.25rem;
      }
      input {
        border: none;
        width: fit-content;
      }
    }
    .mb {
      margin-bottom: 0.5rem;
    }
    .sm {
      font-size: 0.75rem;
      line-height: 1.03rem;
      color: #ffffff;
    }
  }
  .right {
    flex-shrink: 0;
    // .btn {
    //   padding: 0.25rem 0.75rem;
    //   border-radius: 0.25rem;
    //   background: #89d5fd;
    //   color: #f9f9f9;
    // }
    .icon-fontclass-erweima {
      font-size: 3rem;
      color: #ffffff;
    }
  }
}
.mt {
  margin-top: -3rem !important;
}
.posRecord {
  position: fixed;
  top: 8.25rem;
  right: 0;
  background: rgba(0, 0, 0, 0.39);
  font-size: 0.75rem;
  line-height: 1.28rem;
  padding: 0.31rem 0.75rem;
  color: #ffffff;
  border-radius: 0.69rem 0rem 0rem 0.69rem;
}
.orderBox {
  padding: 0.75rem;
  margin: 0 0.75rem;
  margin-top: 0.5rem;
  background: #ffffff;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: column;
  align-items: flex-start;
  .selectBox {
    display: flex;
    align-items: center;
    .statusSet {
      display: flex;
      align-items: center;
      font-size: 0.75rem;
      color: #28b2fa;
      margin-top: 0.5rem;
      margin-left: 1rem;
      position: relative;
      .selectStatusBox {
        position: absolute;
        left: -0.38rem;
        top: 1.47rem;
        border: 0.0313rem solid #e7e7e7;
        box-shadow: 0rem 0rem 0rem rgba(0, 0, 0, 0.1);
        width: 5.75rem;
        height: 4.55rem;
        border-radius: 0.25rem;
        color: #000;
        font-size: 0.75rem;
        background: #ffffff;
        .selectStatusBox_txt {
          padding: 0.63rem 0;
          margin: 0 1.13rem;
        }
        .selectStatusBox_txt:first-child {
          border-bottom: 1.0016px solid #f0f0f1;
        }
      }
    }
  }
  .timeSet {
    padding-left: 0.5rem;
    margin-top: 0.5rem;
    color: #28b2fa;
    display: flex;
    align-items: center;
    .iconfont {
      font-size: 1rem;
    }
    .timeShow {
      margin: 0 0.25rem;
      font-size: 0.75rem;
    }
  }
  .orderList {
    margin-top: 0.72rem;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    justify-content: space-around;
    align-items: center;
    .orderList_lis {
      flex: 1;
      flex-direction: column;
      .num {
        font-size: 0.94rem;
        font-weight: bold;
        color: #333333;
        line-height: 1.31rem;
        margin-bottom: 0.25rem;
      }
      .txt {
        font-size: 0.75rem;
        color: #999999;
      }
    }
  }
  .title {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .left {
      font-size: 0.94rem;
      font-weight: bold;
      line-height: 1.31rem;
    }
    .rigth {
      font-size: 0.75rem;
      color: #999999;
      .icon-course_goon {
        font-size: 0.5rem;
      }
    }
  }
}
.ContenBox {
  padding: 0.75rem 0;
  margin: 0 0.75rem;
  margin-top: -2.5rem;
  background: #ffffff;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  .entrance {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    .entrance_top {
      img {
        width: 2.5rem;
        height: 2.5rem;
      }
    }
  }
  .pos {
    position: relative;
  }
  .pos::after {
    content: "";
    position: absolute;
    left: 0;
    top: 1rem;
    width: 0.0313rem;
    height: 2rem;
    background: #e7e7e7;
  }
}
</style>
